/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/toolbars_below_content_v2.css made available under Mozilla Public License v. 2.0
See the above repository for updates as well as full license text. */

/* This requires Firefox 133
 * By default tabs will be the top-most toolbar, but you can set the following pref to move them to bottom:
 * userchrome.toolbars-below-content.tabs-at-bottom.enabled
 */

#navigator-toolbox{
  display: contents;
  --uc-navbar-height: 40px;
}
:root[uidensity="compact"] #navigator-toolbox{
  --uc-navbar-height: 34px;
}
#main-window > body > #browser,
.global-notificationbox,
 #tab-notification-deck,
 #notifications-toolbar,
 #toolbar-menubar{
  order: -1;
}

#TabsToolbar{
  max-height: calc((var(--tab-min-height) + 2 * var(--tab-block-margin,0px)) * var(--multirow-n-rows,1));
}
#toolbar-menubar,
#TabsToolbar{
  background: inherit !important;
}
@media (-moz-platform: linux){
  :root[sizemode="normal"][customtitlebar] #toolbar-menubar{
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
  }
  #toolbar-menubar,
  #TabsToolbar{
    opacity: 1 !important;
    will-change: unset !important;
  }
  #customizationui-widget-panel[side="top"],
  #notification-popup[side="top"]{
    margin-top: calc(-2 * var(--panel-padding-block) - 40px - 32px - 8.5em) !important;
  }
  #permission-popup[side="top"]{
    margin-top: calc(-2 * var(--panel-padding-block) - 2.5em);
  }
}

#nav-bar,
#PersonalToolbar{
  background-image: linear-gradient(var(--toolbar-bgcolor),var(--toolbar-bgcolor)), var(--lwt-additional-images,var(--toolbar-bgimage)) !important;
  background-position: top,var(--lwt-background-alignment);
  background-position-y: calc(0px - var(--tab-min-height) - 2*var(--tab-block-margin,0px));
  background-repeat: repeat,var(--lwt-background-tiling);
}
:root[lwtheme-image] #nav-bar,
:root[lwtheme-image] #PersonalToolbar{
  background-image: linear-gradient(var(--toolbar-bgcolor),var(--toolbar-bgcolor)),var(--lwt-header-image), var(--lwt-additional-images,var(--toolbar-bgimage)) !important;
}
#PersonalToolbar{
  background-position-y: calc(0px - var(--tab-min-height) - 2*var(--tab-block-margin,0px) - var( --uc-navbar-height));
}
#urlbar[breakout][breakout-extend]{
  display: flex !important;
  flex-direction: column-reverse !important;
  transform: translateY(calc(var(--urlbar-container-height) - 100%));
}
#urlbar[breakout-extend]:not([usertyping]) > .urlbar-input-container::after{
  display: flex;
  content: "";
  height: calc(var(--urlbar-min-height) - 2px - 2 * var(--urlbar-container-padding));
}
.urlbarView-body-inner{ border-top-style: none !important; }

@media -moz-pref("userchrome.toolbars-below-content.tabs-at-bottom.enabled"){
  #TabsToolbar{
    order: 3
  }
}
